package com.keyware.utils;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * 此类描述的是：   List工具类
 * @author: 巨李岗   
 * @version: 2018年1月17日 上午10:15:56
 */
public class ListUtils {
	/**
	 * 
	 * @Title: getDeletedFromOldByNew
	 * @Description: 筛选newList相比oldList减少的元素
	 * @param newList
	 * @param oldList
	 * @return
	 * @author 巨李岗
	 * @return List<String>
	 */
	public static List<String> getDeletedFromOldByNew(List<String> newList, List<String> oldList){
		List<String> strList = new ArrayList<String>();
		String newString = newList.toString();
		for(String string:oldList){
			if(newString.contains(string)){
				continue;
			}else{
				strList.add(string);
			}
		}
		return strList;
	}
	
	/**
	 * 
	 * @Title: getAddedFromOldByNew
	 * @Description: 筛选newList相比oldList增加的元素
	 * @param newList
	 * @param oldList
	 * @return
	 * @author 巨李岗
	 * @return List<String>
	 */
	public static List<String> getAddedFromOldByNew(List<String> newList, List<String> oldList){
		List<String> strList = new ArrayList<String>();
		String oldString = oldList.toString();
		for(String string:newList){
			if(oldString.contains(string)){
				continue;
			}else{
				strList.add(string);
			}
		}
		return strList;
	}
}
